//
// Description: 895. 最长上升子序列
// Created by Loading on 2022/6/2.
//

#include <bits/stdc++.h>

using namespace std;

constexpr int N = 1010;

int a[N];
// dp[i] 表示以 i 结尾的最长上升序列长度
int dp[N];

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
    }

    for (int i = 1; i <= n; ++i) {
        // 最小是 1
        dp[i] = 1;
        for (int j = 1; j < i; ++j) {
            if (a[i] > a[j]) {
                dp[i] = max(dp[i], dp[j] + 1);
            }
        }
    }

    cout << *max_element(dp + 1, dp + n + 1) << endl;

    return 0;
}